package com.example.spring.demo.controller;

import com.example.spring.demo.common.model.req.MessageTaskDTO;
import com.example.spring.demo.entity.Message;
import com.example.spring.demo.entity.Task;
import com.example.spring.demo.service.TaskService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author qwert
 * @version 1.0.0
 * @create 2024/12/29 14:44
 **/
@Slf4j
@RestController
@RequestMapping("/api/task")
@RequiredArgsConstructor
public class TaskController {

    private final TaskService taskService;
    @GetMapping("/userId/{userId}")
    List<Message> getTaskMessageList(@PathVariable int userId) {
        return taskService.getTaskMessageList(userId);
    }

    @GetMapping("/taskId/{taskId}")
    Task getTaskByTaskId(@PathVariable int taskId) {
        return taskService.getTaskById(taskId);
    }

//    @PostMapping("/save")
//    void saveMessageTask(@RequestBody MessageTaskDTO messageTaskDTO) {
//        taskService.saveMessageTask(messageTaskDTO);
//    }
}
